<?php
	class LoginHandler{
		
		private $m_sessionLocation = "Login_handler";	//session som håller reda på om vi är inloggade eller ej
		
		
		public function IsLoggedIn(){	
			if(isset($_SESSION[$this->m_sessionLocation])){	//retunerar session om den finns
				return TRUE;
			}
		}
		public function DoLogin($username, $password){	
			switch($username){
				case 'adam':
					if($password == 'adam'){
						$_SESSION[$this->m_sessionLocation] = TRUE;
						return TRUE;
					}
				case 'johan':
					if($password == 'johan'){
						$_SESSION[$this->m_sessionLocation] = TRUE;
						return TRUE;
					}
				case 'gustav':	
					if($password == 'gustav'){
						$_SESSION[$this->m_sessionLocation] = TRUE;
						return TRUE;
					}
			}
			return FALSE;
		}
		public function DoLogout(){
			if(isset($_SESSION[$this->m_sessionLocation])){
				unset($_SESSION[$this->m_sessionLocation]);	
			}
		}
		
	}
?>